<?php
//赏金明细
namespace app\adminbackstage\model;

use think\facade\Db;
use think\Model;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class UserAmountRewardDetailed extends Model{
    // 模型初始化
    protected static function init()
    {
        parent::init();
        //TODO:初始化内容
    }
    
    public static function listUserAmountRewardDetailed($page=1,$num=10,$where){
        $list = self::field('d.*,u.username,u.phone,u.type as u_type')
        ->alias('d')
        ->leftJoin('user u','u.uid = d.uid')
        ->where($where)
        ->order('id','desc')
        ->limit(($page-1)*$num,$num)
        ->select();
        return $list;
    }
    
//    public static function listAllUserAmountRewardDetailed($page=1,$num=10){
//        $list = self::order('id','desc')
//        ->limit(($page-1)*$num,$num)
//        ->select();
//        return $list;
//    }
    
    public static function countUserAmountRewardDetailed($where) {
        $count = self::alias('d')
        ->leftJoin('user u','u.uid = d.uid')
        ->where($where)
        ->count();
        return $count;
    }
 
    
        
    public static function dSql($sql){
        return self::query($sql);
    }
}
